@import 'common';

.g-modal-wrapper  {
    background: rgba( 0, 0, 0, .5 );
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: -20px;
    text-align: center;

    &.private {
        position: absolute;
    }

    &.g-modal-fade-enter-active {
        animation: g-modal-fade-in .3s
    }

    &.g-modal-fade-leave-active {
        animation: g-modal-fade-out .3s
    }

    @keyframes g-modal-fade-in {
        0% {
            transform: translate3d(0, -20px, 0);
            opacity: 0
        }
        100% {
            transform: translate3d(0, 0, 0);
            opacity: 1
        }
    }

    @keyframes g-modal-fade-out {
        0% {
            transform: translate3d(0, 0, 0);
            opacity: 1
        }
        100% {
            transform: translate3d(0, -20px, 0);
            opacity: 0
        }
    }

    &::after {
        content: '';
        display: inline-block;
        height: 100%;
        width: 0;
        vertical-align: middle;
    }

    .g-modal {
        text-align: left;
        display: inline-block;
        vertical-align: middle;
        background-color: $bgWhite;
        border: 1px solid #c2c7d1;
        box-shadow: 0 4px 10px 1px rgba(48,59,70,0.20);
        border-radius: 4px;
        position: relative;

        .g-modal-header {
            height: 60px;
            line-height: 60px;
            font-size: 18px;
            color: $fontBlack;
            padding: 0 20px;
            border-bottom: 1px solid $bdGray;

            > i {
                float: right;
                line-height: 20px;
                margin-top: 20px;
                cursor: pointer;

                &:hover {
                    color: $primary;
                }
            }
        }

        .g-modal-content {
            padding: 20px;
        }

        .g-modal-footer {
            padding: 0 20px 20px;
        }
    }
}

.g-global-popup {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: .5;
    background: #000;

    &.private {
        position: absolute;
    }

    &.g-global-popup-enter {
        animation: g-global-popup-in .2s ease;
    }
    &.g-global-popup-leave {
        animation: g-global-popup-out .2s ease forwards;
    }

    @keyframes g-global-popup-in {
        0% {
            opacity: 0;
        }
    }

    @keyframes g-global-popup-out {
        100% {
            opacity: 0;
        }
    }
}

.iconfont {
    display: inline-block;
    font-size: inherit;

    &.icon-spin {
        @include animation( icon-spin 2s infinite linear );
    }

    &.icon-pulse {
         @include animation( icon-spin 1s infinite steps(8) );
    }

    @include keyframes( icon-spin ) {
        0% {
            @include rotate(0);
        }
        100% {
            @include rotate(359);
        }
    }
}

// common style class
.g-thumbnail-box {
    @include box-sizing(border-box);
    @include box-shadow(0 0 6px rgba(0, 0, 0, 0.1));
    @include transition(all .3s);
    cursor: pointer;
    &:hover {
        @include box-shadow(1px 4px 10px 2px rgba(0, 0, 0, 0.3));
    }
}

.g-btn {
    cursor: pointer;
    border-radius: $bdRadius;
    min-width: 66px;
    height: 28px;
    line-height: 26px;
    padding: 0 18px;
    border: 1px solid darken($bdGray, 5%);
    background-color: $bgWhite;
    color: $fontBase;
    text-align: center;
    &:hover {
        border-color: darken($bdGray, 15%);
    }
    &.g-btn-radius {
        border-radius: 14px;
    }
    &.g-btn-info {
        border: 1px solid $primary;
        color: $primary;
        &:hover {
            border-color: $darkPrimary;
            background-color: lighten($bdGray, 5%);
        }
    }
    &.g-btn-primary {
        border: 1px solid $primary;
        background-color: $primary;
        color: $fontWhite;
        &:hover {
            background-color: darken($primary, 6%) !important;
        }
    }
    &.g-btn-danger {
        border: 1px solid $danger;
        background-color: $danger;
        color: $fontWhite;
        &:hover {
            background-color: darken($danger, 6%) !important;
        }
    }
    &.g-btn-lg {
        min-width: 160px;
        height: 32px;
        line-height: 30px;
        font-size: 14px;
        padding: 0 30px;
        &.circular {
            border-radius: 16px;
        }
    }
    &.g-btn-sm {
        min-width: 44px;
        height: 24px;
        line-height: 22px;
        font-size: 12px;
        padding: 0 8px;
        &.circular {
            border-radius: 12px;
        }
    }
}


input[type=checkbox] {
    position: relative;
    margin: 0 1px 0 0;
    cursor: pointer;
    @include user-select(none);
    border: 1px solid rgba(0, 0, 0, .25);
    border-radius: 0;
    @include appearance(none);
}

// 单选按钮和多选按钮
input[type=checkbox] {
    bottom: 2px;
    width: 14px;
    height: 14px;
    vertical-align: middle;
    background-color: #f2f2f2;
}

input[type=checkbox]:disabled {
    background-color: #eee;
}

input[type=checkbox]:checked {
    border: 0;
    background-color: $primary;
}

input[type=checkbox]:checked::before {
    position: absolute;
    top: 6px;
    left: 4px;
    width: 65%;
    height: 2px;
    content: '';
    @include rotate(135);
    background-color: #fff
}

input[type=checkbox]:checked::after {
    position: absolute;
    top: 7px;
    left: 2px;
    width: 5px;
    height: 2px;
    content: '';
    @include rotate(-135);
    background-color: #fff
}

input[type=radio] {
    position: relative;
    bottom: 2px;
    width: 14px;
    height: 14px;
    vertical-align: middle;
    border-radius: 50%;
    cursor: pointer;
    margin: 0 1px 0 0;
    @include user-select(none);
    border: 1px solid #A3ABB0;
    @include appearance(none);
}

input[type=radio]:checked {
    border: 4px solid $primary;
    background-image: none
}




